/*
 * @Author: your name
 * @Date: 2021-10-04 16:58:42
 * @LastEditTime: 2021-10-04 18:11:45
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \luogu\1.2排序\P1177\main.cpp
 */
#include<iostream>

using namespace std;

// const int MAX_LENGTH = 1000000010;
const int MAX_LENGTH = 100;

//递归快排
void quickSort(int a[],int low,int high);

int main(){
    int a[MAX_LENGTH];
    int n;
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    quickSort(a,0,n-1);
    for(int i=0; i<n; i++){
        cout << a[i] << " ";
    }
    return 0;
}

void quickSort(int a[],int low,int high)
{
    if(low < high){
        int left = low;
        int right = high;
        //归位数
        int tem = a[low];
        while(left < right){
            //右边小于tem的
            while(left < right && a[right] >= tem){
                right--;
            }
                a[left] = a[right];
            //左边大于tem的
            while(left < right && a[left] <= tem){
                left++;
            }
                a[right] = a[left];
        }
        //tem归位
        a[left] = tem;
        //两边递归
        quickSort(a,low,left-1);
        quickSort(a,right+1,high);
    }
}